<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://acegisecurity.org/authz" prefix="authz"%>

<html>
<head>
<title><tiles:getAsString name="title" /></title>
<link rel="stylesheet" href="<c:url value="/css/style.css" />" type="text/css" />
<script src="js/IEmarginFix.js" type="text/javascript"></script>
</head>
<body>

<div id="container">
<div id="header">
<table width="100%">
<tr>
<td align="left"><a href="<c:url value="/home.html" />"><img src="<c:url value="/image/logo.gif" />" /></a></td>
<td align="right"><a href="<c:url value="/home.html" />"><img src="<c:url value="/image/phrase.gif" />" /></a></td>
</tr>
</table>
</div>
<div class="clearfix">
<div id="hmenu">
<ul>
  <li><a href="<c:url value="/home.html" />">home</a></li>
  <li><a href="<c:url value="/index.html" />">inventory</a></li>
  <li><a href="<c:url value="/buy.html" />">buy</a></li>
  <li><a href="<c:url value="/sell.html" />">sell</a></li>
  <li><a href="<c:url value="/requestForm.html" />">contact us</a></li>
</ul>
</div>
<authz:authorize ifAllGranted="ROLE_SUB_ADMIN">
  <div id="hmenu">
  <ul>
    <li><a href="<c:url value="/private/carForm.html" />">cars</a></li>
	<authz:authorize ifAllGranted="ROLE_ADMIN">
    	<li><a href="<c:url value="/private/contactForm.html" />">contacts</a></li>
    </authz:authorize>
    <li><a href="<c:url value="/private/logout.html" />">logout</a></li>
  </ul>
  </div>
</authz:authorize>

<div class="clearfix">
<div id="content">

<c:if test="${not empty message}">
  <table width="100%">
    <tr>
      <td align="center">
      <div id="message"><span class="attribute">${message}</span></div>
      </td>
    </tr>
  </table>
</c:if>

<spring:hasBindErrors name="command">
	<div id="errorBox">
		<fmt:message key="${(errors.allErrors[0].code == 'typeMismatch')?errors.allErrors[0].codes[2]:errors.allErrors[0].code}"></fmt:message> 
	</div>
</spring:hasBindErrors> 

<tiles:insert attribute="body" />

</div>
<div id="vmenu">
  <form action="<c:url value="/listCarsByModel.html" />">
  	<input type="text" name="model" size="14" value="${param.model}" /><br>
  	<input type="submit" value="Search">
  </form>
  <p>
  <a href="<c:url value="/listAllCars.html" ><c:param name="count" value="${cache[cars].carCount}" /></c:url>" class="left">All cars (${cache[cars].carCount})</a>
  <p>
  <c:forEach items="${cache[cars].makeCount}" var="make">
  	<div class="lmenu">
    <a href="<c:url value="/listCarsByMake.html"><c:param name="id" value="${make[2]}" /><c:param name="count" value="${make[1]}" /></c:url>" class="left">${make[0]} (${make[1]})</a>
    </div>
  </c:forEach>
  <p/>
</div>
</div>
</div>
<div id="footer" align="center">
Classic Network | Tel: +32-479.71.10.79 | Fax: +32-2.344.20.88 | info@classicnetwork.net
</div>
</div>
</body>

</html>
